package com.company.project.controller.ldjsc.concern;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;

import com.company.project.common.utils.DataResult;
import com.company.project.entity.ldjsc.concern.HbAppMenuEntity;
import com.company.project.service.ldjsc.concern.HbAppMenuService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * APP菜单表
 *
 * @author wenbin
 * @email *****@mail.com
 * @date 2025-07-03 11:05:46
 */
@Controller
@RequestMapping("/sxzy/appMune")
public class HbAppMenuController {
    @Autowired
    private HbAppMenuService hbAppMenuService;

    /**
    * 跳转到页面
    */
    @GetMapping("/index/hbAppMenu")
    public String hbAppMenu() {
        return "hbappmenu/list";
    }

    @ApiOperation(value = "查询分页数据")
    @PostMapping("hbAppMenu/listByPage")
    @SaCheckPermission("hbAppMenu:list")
    @ResponseBody
    public DataResult findListByPage(@RequestBody HbAppMenuEntity hbAppMenu){
        LambdaQueryWrapper<HbAppMenuEntity> queryWrapper = Wrappers.lambdaQuery();
        //查询条件示例
        queryWrapper.eq(HbAppMenuEntity::getId, hbAppMenu.getId());
        queryWrapper.orderByDesc(HbAppMenuEntity::getId);
        IPage<HbAppMenuEntity> iPage = hbAppMenuService.page(hbAppMenu.getQueryPage(), queryWrapper);
        return DataResult.success(iPage);
    }


    @ApiOperation(value = "新增")
    @PostMapping("hbAppMenu/add")
    @SaCheckPermission("hbAppMenu:add")
    @ResponseBody
    public DataResult add(@RequestBody HbAppMenuEntity hbAppMenu){
            hbAppMenuService.save(hbAppMenu);
        return DataResult.success();
    }

    @ApiOperation(value = "删除")
    @DeleteMapping("hbAppMenu/delete")
    @SaCheckPermission("hbAppMenu:delete")
    @ResponseBody
    public DataResult delete(@RequestBody @ApiParam(value = "id集合") List<String> ids){
            hbAppMenuService.removeByIds(ids);
        return DataResult.success();
    }

    @ApiOperation(value = "更新")
    @PutMapping("hbAppMenu/update")
    @SaCheckPermission("hbAppMenu:update")
    @ResponseBody
    public DataResult update(@RequestBody HbAppMenuEntity hbAppMenu){
            hbAppMenuService.updateById(hbAppMenu);
        return DataResult.success();
    }



}
